ADD_EXECUTABLE(lkt-test main.c)
ADD_EXECUTABLE(http_proxy http_proxy.c)
INCLUDE_DIRECTORIES(../src)
SET(OPENSSL_PATH ${CMAKE_SOURCE_DIR}/dep/openssl-${PLATFORM}/${SUBPLATFORM})
SET(EVENT_PATH ${CMAKE_SOURCE_DIR}/dep/libevent-${PLATFORM}/${SUBPLATFORM})
SET(ZLIB_PATH ${CMAKE_SOURCE_DIR}/dep/zlib-${PLATFORM}/${SUBPLATFORM})

IF (WIN32)  
    SET(LIBWIN -lws2_32 -lgdi32 -lcrypt32)
ELSEIF (APPLE)  
ELSEIF (UNIX)  
    if ("${PLATFORM}" STREQUAL "Android") #Android没有-lrt, -lpthread
        SET(LIBRT "")
    else ()
        SET(LIBRT -lrt)
        SET(LIBPTHREAD -lpthread)
    endif()
ENDIF ()  

#locketcipher必须要在crypto.a前面，否则会出现链接错误
TARGET_LINK_LIBRARIES(lkt-test -lm ${LIBPTHREAD} locketcipher ${OPENSSL_PATH}/lib/libcrypto.a ${LIBWIN} ${EXTRALIB})
INSTALL(TARGETS lkt-test RUNTIME  DESTINATION bin/${SUBPLATFORM})

TARGET_LINK_LIBRARIES(http_proxy ${LIBRT} locketcipher ${OPENSSL_PATH}/lib/libcrypto.a ${OPENSSL_PATH}/lib/libssl.a ${EVENT_PATH}/lib/libevent_openssl.a  ${EVENT_PATH}/lib/libevent.a ${LIBWIN} ${ZLIB_PATH}/lib/libz.a ${EXTRALIB})
#TARGET_LINK_LIBRARIES(http_proxy ${LIBRT} locketcipher ${OPENSSL_PATH}/lib/libcrypto.a ${OPENSSL_PATH}/lib/libssl.a ${EVENT_PATH}/lib/libevent_openssl.a ${EVENT_PATH}/lib/libevent.a ${LIBWIN} ${ZLIB_PATH}/lib/libz.a ${EXTRALIB} ${LIBRT} ${LIBPTHREAD}) //Linux7.3, 7.4用法, 待研究
INSTALL(TARGETS http_proxy RUNTIME  DESTINATION bin/${SUBPLATFORM})
